package com.fs.zx.common.starter.util;

import com.google.common.collect.Lists;

import java.util.Collection;
import java.util.Objects;

public class CommonUtils {

    public static boolean isEmpty(Collection collection) {
        return Objects.isNull(collection) || collection.isEmpty();
    }
    public static boolean isNotEmpty(Collection collection) {
        return !isEmpty(collection);
    }

    public static boolean isEmpty(CharSequence str) {
        return Objects.isNull(str) || Objects.equals("",str.toString().trim());
    }
    public static boolean isNotEmpty(CharSequence str) {
        return !isEmpty(str);
    }

    public static boolean isEmpty(CharSequence... str) {
        if (Objects.isNull(str)){
            return true;
        }
        return Lists.newArrayList(str).stream().allMatch(CommonUtils::isEmpty);
    }
    public static boolean isNotEmpty(CharSequence... str) {
        return !isEmpty(str);
    }
}
